package com.ecfront.dao.impl;

import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.ecfront.dao.GoodsComplainDAO;
import com.ecfront.pojo.GoodsComplain;

/**
 * @version 1.0
 * @author www.ecfrom.com
 */

public class GoodsComplainDAOImpl extends HibernateDaoSupport implements GoodsComplainDAO {

	protected void initDao() {}

	public void save(GoodsComplain transientInstance) {
		getHibernateTemplate().saveOrUpdate(transientInstance);
	}

	public void delete(GoodsComplain persistentInstance) {
		getHibernateTemplate().delete(persistentInstance);
	}

	public GoodsComplain findById(java.lang.Integer id) {
		GoodsComplain instance = (GoodsComplain) getHibernateTemplate()
					.get("com.ecfront.pojo.GoodsComplain", id);
		return instance;
	}

	public List findByProperty(String propertyName, Object value) {
		String queryString = "from Goodscomplain as model where model."
					+ propertyName + "= ?";
		return getHibernateTemplate().find(queryString, value);
	}


	public List findByGcSort(Object gcSort) {
		return findByProperty(GC_SORT, gcSort);
	}


	public List findByGcContent(Object gcContent) {
		return findByProperty(GC_CONTENT, gcContent);
	}


	public List findAll() {
		String queryString = "from GoodsComplain";
		return getHibernateTemplate().find(queryString);
	}

	public static GoodsComplainDAO getFromApplicationContext(
			ApplicationContext ctx) {
		return (GoodsComplainDAO) ctx.getBean("GoodsComplainDAO");
	}
}